import 'package:flutter/material.dart';
import 'package:flutter_music/page/binding/main_binding.dart';
import 'package:flutter_music/page/main_page.dart';
import 'package:flutter_music/routes/app_aroutes.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return RefreshConfiguration(
      footerTriggerDistance: 15,
        dragSpeedRatio: 0.91,
        headerBuilder: () => const MaterialClassicHeader(),
        footerBuilder: () => const ClassicFooter(),
        enableLoadingWhenNoData: false,
        enableRefreshVibrate: false,
        enableLoadMoreVibrate: false,
        shouldFooterFollowWhenNotFull: (state) {
        return false;
        },
        child: ScreenUtilInit(
          designSize: const Size(750, 1334),
          builder: (_,child) => GetMaterialApp(
            debugShowCheckedModeBanner: false,
            getPages: AppRoutes.routerPages,
            defaultTransition: Transition.rightToLeft,
            transitionDuration: const Duration(milliseconds: 150),
            title: "OpenEye",
            theme: ThemeData(
              primarySwatch: Colors.red
            ),
            initialBinding: MainBinding(),
            home: const MainPage(),
            locale: const Locale('zh'),
          ),
        )
    );
  }
}

